class Car:

    def __init__(self,luntai,yanse,chuanhu,xinghao):
        self.luntai=luntai
        self.yanse=yanse
        self.chuanhu=chuanhu
        self.xinghao=xinghao

    # dangwen: str = "P"  对形参dangwen限制为字符串类型，并且给默认值
    def guadang(self,dangwen:str = "P"):
        if dangwen.upper() =="D":
            self.qianjin()   #调用成员方法
        elif dangwen.upper()=="R":
            self.houtui()
        else:
            print("停止")
    def qianjin(self):
        print("前进")
    def houtui(self):
        print("后退")
    def wurenjiashi(self):
        print("无人驾驶")
    def shache(self):
        print("刹车")
    def jiayou(self):
        print("加油")







